/**
 * @author Tobias Boehm
 *
 * 03.05.2011
 */
package org.anddev.andengine.extension.tbsengine.menu.view;

import org.anddev.andengine.extension.tbsengine.R;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * This is a container for elements listed in rows inside an implementation of
 * {@link AbsPrepareMatchChoiceDialog}.
 * 
 * @author Tobias Boehm
 *
 */
public class ImageOrTextListElementRow extends LinearLayout {

	public ImageOrTextListElementRow(final Activity pActivity, final Drawable pImage, final String pText) {
		super(pActivity);
		
		pActivity.getLayoutInflater().inflate(R.layout.imagetextlistelement_row, this);
		
		final ImageView imageView = (ImageView) this.findViewById(R.id.ITLERimageV);
		
		if(pImage != null){
			
			imageView.setImageDrawable(pImage);
		
		}else{

			imageView.setVisibility(GONE);
		}
		
		final TextView textView = (TextView) this.findViewById(R.id.ITLERtextV);
		
		if(pText != null){
					
			textView.setText(pText);
		
		}else{
			
			textView.setVisibility(GONE);
		}
	}
}
